<?php
class database {
	private $link;
	private $host;
	private $user;
	private $pass;
	private $db;
	private $table;
	private $column;
	
	public function __construct($user, $pass, $db, $host, $charset) {
		$this->link = new mysqli($host, $user, $pass, $db) or die($this->link->error);
		$this->link->set_charset($charset) or die($this->link->error);
		$this->link->select_db($db) or die($this->link->error);
	}
	public function __destruct() {
		$this->link->close();
		unset(
			$this->link,
			$this->host,
			$this->user,
			$this->pass,
			$this->db,
			$this->table,
			$this->column);
	}
	public function get($queryString) {
		return $this->link->query($queryString);
	}
}

class display {
	private $contents;
	
	public function __construct($contents) {
		$this->contents = $contents;
	}
	public function __destruct() {
		unset($contents);
	}
	public function displayPost($id, $title, $content, $date, $author) {
		echo "
			<span class=\"postTitle\">
				<a class=\"postTitle\" name=\"$id\">" . $title . "</a>
			</span>
			<br />
			<span class='postTime'>Added by: " . $author . " - " . $date . "</span>
			<br /><br />
			<div class=\"postContent\">" . $content . "</div>
			<br />
			<a href=\"#top\">Back to the Top</a>
			<div id=\"bar\"></div>
			<br />
		";
	}
}
?>